package com.currentcms.client.event;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.ui.Widget;

public class ConfirmEvent extends GwtEvent<ConfirmHandler>
{

	private static Type<ConfirmHandler> TYPE;

	public static Type<ConfirmHandler> getType()
	{
		if (TYPE == null)
		{
			TYPE = new Type<ConfirmHandler>();
		}
		return TYPE;
	}

	private Widget _source;
	private Object _data;

	public ConfirmEvent(Widget source)
	{
		this(source,null);
	}
	
	public ConfirmEvent(Widget source, Object data)
	{
		_source = source;
		_data = data;
	}

	public Widget getSource()
	{
		return _source;
	}
	
	public Object getData()
	{
		return _data;
	}
	


	@Override
	public final Type<ConfirmHandler> getAssociatedType()
	{
		return TYPE;
	}

	@Override
	public String toDebugString()
	{
		assertLive();
		return super.toDebugString();
	}

	@Override
	protected void dispatch(ConfirmHandler handler)
	{
		handler.onConfirmEvent(this);
	}
}
